package com.itheima.state;

import java.io.ObjectInputStream;

public class Demo02 {
    //waiting
    public static void main(String[] args) throws InterruptedException {
        Object o = new Object();
        Thread t1 = new Thread(() -> {
            synchronized (o) {
                try {
                    o.wait();
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                System.out.println("等待结束以后的状态" + Thread.currentThread().getState());
            }

        });
        t1.start();
        Thread.sleep(50);
        Thread.State state = t1.getState();
        System.out.println("等待时的状态" + state);
        Thread.sleep(100);
        Thread t2 = new Thread(() -> {
            synchronized (o) {
                o.notify();
            }

        });
        t2.start();

    }
}
